Skip to content

release-binaries: give linux-x86_64-pgo a profile trained on Ocarina of Time - #1909

Open
danieljesus wants to merge 17 commits into
zortos293:nx2from
danieljesus:perf/linux-pgo-profile
Open

danieljesus wants to merge 17 commits into
zortos293:nx2from
danieljesus:perf/linux-pgo-profile

Conversation

@danieljesus

@danieljesus danieljesus commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

The Linux counterpart of #1884 (Windows).

What

The Linux PGO build compiles against eglantine.profdata, which predates most of the Switch 2 code. This adds lichii-linux.profdata: that same profile (weight 1, its author's checkout prefix stripped) merged with two sessions of Ocarina of Time gameplay on a Steam Deck (weight 12), trained on this PR's tree. linux-x86_64-pgo now uses it through the matrix's profile field, which the Windows job already uses. Merging instead of replacing keeps Eglantine's records where they still match: they were trained against libstdc++ 14 or later (they include std::vector::_M_realloc_append, which GCC 13's headers lack), so with the job pinned to GCC 13 those whose inlined library code differs no longer match and add nothing.

What the profile was trained with: an Ubuntu 24.04 container with

  • clang 23.1.6 from apt.llvm.org, the build the job installs (PGO_LLVM_VERSION; the job now names it in PGO_CLANG_BUILD and warns when the installed one differs);
  • GCC 13's libstdc++ headers, GCC 13 being the only GCC in that container;
  • the job's configuration, with local function names keyed from src/.

The hosted ubuntu-24.04 image carries GCC 12, 13 and 14, and clang picks the newest by default. So the job now pins GCC 13 for this entry:

  • it passes --gcc-install-dir to clang;
  • it fails early if that GCC is missing from the image;
  • it prints the toolchain it builds with;
  • it warns when the installed clang build differs from the one that trained the profile.

Without the pin, a profile trained against one libstdc++ loses its counts on the functions whose inlined library code differs between the two headers. Our fork's release run showed it: built on this runner with this job and a profile of the same kind, without the pin, the PGO build lost the profile on 308 functions with counts. 63 of them are non-template code: the renderer's state updates (UpdateVertexInput, UpdateDynamicStates, UpdateDepthBias, ...), the macro engine and the shader translator. Our fork's job also passes -mllvm -no-pgo-warn-mismatch-comdat-weak=false, so its log listed template functions too: 1,036 of its lines were for std::vector::_M_realloc_append, which only GCC 14's headers have. That shows GCC 14's headers were in use; those records came from Eglantine's profile.

It also fixes something that made any profile trained outside the runner lose part of its effect. A profile names a file-local function (static, or in an anonymous namespace) by the path of its source file, so a profile trained in one checkout matched none of those functions when the job built in another: about a fifth of the profile's functions (14,763 of 78,301 records) silently got no data. The job and the training build now both pass -mllvm -static-func-strip-dirname-prefix=N, with N the depth of the source root, so those names start at src/ and match in any checkout. eglantine.profdata had the same problem with its author's path; the merge strips it (steps in docs/CI.md).

So that this cannot go unnoticed again, the job passes -mllvm -pgo-warn-missing-function and -mllvm -no-pgo-warn-mismatch-comdat-weak=false (diagnostics only), the PGO summary counts missing-profile warnings and functions that lost data with counts, and it warns when the first passes PGO_MISSING_MAX (3000) or is 0 (the flags did not reach the build), and when the second passes PGO_MISMATCH_MAX (10). The configure step also stops the job unless clang reports the pinned GCC as the one it selected. A matrix entry with pgo but no profile is now an error instead of falling back to eglantine.profdata; both PGO entries set one.

docs/CI.md gains the rule this came from: a platform's measurement must be of a binary built exactly as the job builds it, toolchain and standard library included.

A profile ages with the tree. Applied to a tree 20 upstream commits newer than the one it was trained on, this profile lost its data for 12 of our functions that training had reached, among them the shader compiler's SSA rewrite pass and the Vulkan fence manager's release thread. On its own tree it lost none. So it is retrained on this PR's tree: applied from a checkout other than the training one with this tree's flags, 5 functions report changed code, the only one with counts being lichii-cmd's main (it shares its name with the lichii executable's main, which training reached). None of the others is in src/, and there are 1,282 missing-profile warnings. The job's summary counts such functions (hash mismatches with counts), and that count, not the number of commits since training, is the signal to retrain.

Files: lichii-linux.profdata (21.5 MB, sha256 86c4bd40…c229), .github/workflows/release-binaries.yml, docs/CI.md (the flags, the GCC pin, the counts, how to retrain, and the rule).

Measurements

Steam Deck OLED (Zen 2, 4 cores, RADV), Ocarina of Time, Kokiri Forest route. Measured with the profile as first trained (the same recipe, on the tree 20 commits older), on that tree, against eglantine.profdata:

  • both built with clang 23, the job's configure flags and GCC 13's libstdc++, in a checkout other than the one the profile was trained in;
  • so the baseline is eglantine.profdata built against GCC 13's headers, not the published build (which compiled against GCC 14's). Eglantine's profile was trained against libstdc++ 14 or later, so this baseline handicaps it, and the gain below may be larger than against the published build.

Four alternating pairs:

eglantine.profdata, GCC 13 the first-trained profile, GCC 13 Change
Standing fps 18.20 19.41 +6.6 %
Panning fps 14.64 15.82 +8.1 %
Missing-profile warnings 31,799 1,132
Functions whose code changed since training 2,191 4

On this PR's tree the retrained profile gives 1,282 missing-profile warnings and 5 changed functions (above).

The new build was ahead in all four pairs, standing and panning.

These were measured on our own builds, not on the job's artifact, and not against the published build: fps against the published artifact were not measured. The workflow runs only on dispatch, a push to nx2-experimental or its schedule, so the job's own artifact needs a manual run. Until that run, that the runner's clang selects GCC 13 is checked on a Steam Deck only; the run's log ("Selected GCC installation", now a gate) and its PGO summary (expected: 1,282 missing-profile warnings, lichii-cmd's main the only function with counts lost) are what confirm it there.

The figures in this PR's first version (+4.2 % / +7.0 %) were measured in the checkout the profile had been trained in. On the runner the file-local functions would not have matched, so part of that gain would not have appeared there; the strip flag is what makes the measurement above hold in any checkout.

Not measured

Other games, other x86_64 CPUs, and aarch64. The profile is weighted towards the paths Ocarina of Time reaches, like the Windows one. -static-func-strip-dirname-prefix is an internal LLVM option, verified with clang 23.1.6; if a later LLVM drops it the build fails on the unknown option rather than silently losing the match.

Which GCC to pin is a choice. Pinning 13 matches Ubuntu 24.04's default and the container our profile was trained in; Eglantine's records whose inlined library code comes from libstdc++ 14 then match nothing. Pinning 14 (what the runner's clang picks by itself) would keep more of Eglantine's records alive (one reviewer count: 1,793 of its 15,850 records with counts, 33 % of its count mass, have a hash different from a GCC 13 build's), at the cost of retraining our profile on 14 (a container with gcc-14), with ours at weight 12 either way. This PR keeps 13; the pin is explicit whichever number is chosen.

The Windows entry has a counterpart of the path problem (its profile's keys carry the checkout path). That comes as a separate PR once this one is in, since it can only be checked on a run.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF

Summary by CodeRabbit

  • Builds
    • Linux x86-64 release builds use a combined profile based on Eglantine and Ocarina of Time gameplay data.
    • Linux build summaries report missing profile data and profile mismatches, including when warning thresholds are exceeded or expected profile data is absent.
    • Linux PGO builds check for the expected compiler and profile configuration, and verify GCC 13 is available. Non-PGO Linux build summaries include compiler information.
  • Documentation
    • Expanded Linux profile documentation with details on profile inputs, warning thresholds, build configuration requirements, measurement criteria, and profile updates.

…of Time

The Linux PGO builds use eglantine.profdata, which predates most of the
Switch 2 code. Add lichii-linux.profdata, that profile (weight 1) merged
with two sessions of Ocarina of Time gameplay on x86_64 (weight 12),
trained on nx2 b9be325 with clang 23 as the job builds, and use it for
linux-x86_64-pgo. linux-aarch64-pgo keeps eglantine.profdata, since no
aarch64 profile has been measured.

Steam Deck OLED, nx2 b9be325 built with the job's flags, old profile vs
new, 3 interleaved rounds, standing / panning fps in Kokiri Forest with
Max Resolution: Low 20.36 / 15.97 -> 21.21 / 17.09 (+4.2 % / +7.0 %),
High 17.96 / 14.45 -> 18.47 / 15.48 (+2.8 % / +7.1 %).

docs/CI.md gets a Linux section with the retraining steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcx3CbFgcY6d7BpdyKC
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

The Linux x86-64 PGO build selects lichii-linux.profdata and checks its compiler configuration. The workflow summarizes mismatch and missing-profile warnings against configured thresholds. Release notes and CI documentation describe the profile and its reporting.

Changes: Linux PGO profile selection

Layer / File(s) Summary
Profile selection and configuration
.github/workflows/release-binaries.yml
The Linux x86-64 matrix entry selects lichii-linux.profdata. The workflow requires a nonempty selected profile, checks the pinned GCC installation, and verifies that clang selects it. Linux PGO configuration uses the selected profile and adds LLVM options to normalize static-function names and report missing profile data.
Warning reporting and profile documentation
.github/workflows/release-binaries.yml, docs/CI.md
The workflow deduplicates mismatched function names and counts functions with nonzero discarded counts. It warns when Linux missing-profile warnings exceed 3,000, are absent, or when discarded-count functions exceed 10. Release notes and CI documentation describe the merged profile, reporting, thresholds, toolchain requirements, and retraining steps.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Possibly related issues

  • zortos293/Lichii#2526: The issue concerns Linux PGO profile mismatches and warning visibility. This PR changes the Linux profile and adds mismatch and missing-profile reporting, although the issue describes a different mismatch cause.

Possibly related PRs

  • zortos293/Lichii#1205: This PR selects an Ocarina of Time-trained Linux profile merged with Eglantine’s profile. It uses different merge weights and a different merge method.
  • zortos293/Lichii#2527: This PR changes Linux PGO mismatch summaries. It counts diagnostics, while this PR deduplicates function names and counts functions with nonzero discarded counts.

Suggested reviewers: zortos293

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the linux-x86_64-pgo release build now uses a profile trained on Ocarina of Time gameplay data (lichii-linux.profdata, merged with eglantine.profdata). The changeset a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the linux-x86_64-pgo release build now uses a profile trained on Ocarina of Time gameplay data (lichii-linux.profdata, merged with eglantine.profdata). The changeset adds that profile, wires it into the workflow, and documents it in docs/CI.md. The title omits the GCC 13 pinning, diagnostics, and thresholds, which is acceptable because it need not cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Incomplete review coverage

1 file(s) could not be reviewed because their content or diff was unavailable or exceeded a size limit. These files were not reviewed. Findings cover only the remaining files.

  • lichii-linux.profdata: a text diff could not be generated.

The fully-reviewed checkpoint was not advanced. CodeRabbit will not automatically approve this review or resolve existing threads from this partial comparison.

Retry the review after resolving file access or diff-generation failures. If the files do not need review, explicitly exclude them in your review configuration.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 617edf79-140f-4913-9478-ed55881fb39d
Commits

Reviewing files that changed from the base of the PR and between d8322bc and 6b020a9.

Files selected for processing: 2

  • .github/workflows/release-binaries.yml
  • docs/CI.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 16, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 16, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 17, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 17, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 17, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 18, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 18, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 18, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 19, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 19, 2026
danieljesus added a commit to danieljesus/Lichii that referenced this pull request Nov 20, 2026
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcx3CbFgcY6d7BpdyKC
danieljesus added a commit to danieljesus/Lichii that referenced this pull request Nov 21, 2026
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcx3CbFgcY6d7BpdyKC
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 21, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 21, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 21, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 22, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 22, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 22, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 22, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 22, 2026
PixelHabits added a commit to Kaepora-HQ/Lichii that referenced this pull request Nov 23, 2026
The x86-64 Linux PGO packages compiled against eglantine.profdata,
which was trained on another game. They now compile against
lichii-linux.profdata: eglantine.profdata merged with a profile of
Ocarina of Time played on x86-64 Linux, weighted to twice Eglantine's
total count, the share Ocarina has in upstream's pull request zortos293#1909.
linux-aarch64-pgo keeps eglantine.profdata.

The session behind it is about 66,700 frames of scripted play through
the debug server, in two rounds of nine starts: a new game's opening,
Link's house with a menu save, Kokiri Forest, Hyrule Field, Castle
Town, the Bazaar, the Deku Tree's first room and its chest, Dodongo's
Cavern and Zora's Domain. Each start began with the title's pipeline
cache empty. Every start recompiles the cached pipelines, and with a
full cache the shader compiler took 49% of the counts; it holds 2.6%
here. The first round overlaps the whole session by 98.1%. The static
functions' source paths were rewritten to
/home/runner/work/Lichii/Lichii, where this workflow compiles, so they
match in the release. The static functions in eglantine.profdata and
zortos293#1909's profile carry their trainers' paths, so none of them match
there.

The profile is trained on this source. A profile of the same session
trained 16 upstream commits earlier, at upstream's 7088f67, had lost
10.3% of its counts by this source: 275 of the 20,131 functions it
counted had changed, and 77 were gone.

That earlier profile was measured on a Ryzen 7 8845HS with a Radeon
780M at 1x, on its own source built with clang 23.1.6 the way
linux-x86_64-pgo builds it: the game's processor time per presented
frame over the same scripted scene, median of three runs per build and
scene. The file committed here has not been measured.

  Scene             No profile  eglantine  zortos293#1909   That profile
  Kokiri Forest       117.1 ms     -1.0%   -3.1%      -3.7%
  Kakariko Village    111.2 ms     -0.5%   +2.9%      -2.4%
  Goron City           99.8 ms     -0.7%   -1.6%      -3.7%

The session never visits Kakariko Village or Goron City. Every run
with that profile used less processor time than every run without a
profile, in all three scenes. Against zortos293#1909's profile its medians are
lower in all three, but the runs overlap in Kokiri Forest and Goron
City, and in Kakariko Village the runs with zortos293#1909's profile spread
6.7%. The GPU was 92 to 94% busy, so the frame rate moved 1 to 2.5%.
-march=znver4 on top of that profile made no measurable difference.
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 23, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 23, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 24, 2026
…ntly of the checkout path

linux-x86_64-pgo now uses lichii-linux.profdata: eglantine.profdata,
weight 1, merged with two sessions of Ocarina of Time gameplay on x86-64
Linux, weight 12.

A profile names a file-local function by its source file's path, so a
profile trained in one checkout matched nothing of those functions on
the runner. The job and the training build now both pass
-mllvm -static-func-strip-dirname-prefix with the depth of the source
root, which makes those names start at src/. The job also passes
-mllvm -pgo-warn-missing-function; the summary counts those
missing-profile warnings and warns past PGO_MISSING_MAX (3000). A matrix
entry with pgo but no profile is now an error instead of falling back to
eglantine.profdata; both PGO entries set one.

On a Steam Deck OLED (Ocarina of Time, Kokiri Forest route), the tip
built with this profile against the tip as the job builds it today with
eglantine.profdata, both built in a checkout other than the one the
profile was trained in: +6.6 % fps standing, +8.1 % panning (4
alternating pairs each). Missing-profile warnings drop from 31,799 to
1,132, functions whose code changed since training from 2,191 to 4.

docs/CI.md describes the flags, the counts and how to retrain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcx3CbFgcY6d7BpdyKC
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
…to perf/linux-pgo-profile

The conflict with nx2 was in release-binaries.yml; the result is the tree of the
retrained change, which replaces this branch's earlier profile, workflow and docs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
@danieljesus

Copy link
Copy Markdown
Contributor Author

Updated on top of current nx2 (the conflict was in release-binaries.yml), with a retrained profile and one fix that changes what this PR is worth.

While checking the profile against a build made the way the runner makes it, we found that a profile names file-local functions by their source file's path, so a profile trained in one checkout matches none of them in another: about a seventh of the functions got no data, with no warning. The first version of this PR had that problem, and so does eglantine.profdata as the job uses it today. The job and the training build now pass -mllvm -static-func-strip-dirname-prefix, the summary counts missing-profile warnings so a mismatch shows, and the description has new figures measured with both builds made outside the training checkout: +6.6 % standing and +8.1 % panning on a Steam Deck against today's Linux PGO build. The earlier figures were measured in the training checkout and overstated what the runner would have produced; the description says so.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF

atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 26, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 27, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 27, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 27, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 28, 2026
danieljesus and others added 4 commits November 28, 2026 10:14
…file was trained with

lichii-linux.profdata was trained with GCC 13's libstdc++ headers
(Ubuntu 24.04's default). The hosted ubuntu-24.04 image also carries
GCC 14, and clang compiles against the newest GCC it finds. A profile
hashes each function's control flow with the std:: code inlined into
it, so a build against GCC 14's headers matches none of the functions
that inline code from those headers.

A fork's release build with this job and this kind of profile showed
it: its Linux PGO package lost the profile data of 308 functions with
counts, 63 of them non-template code (the renderer's state updates,
the macro engine, the shader translator). 1,036 of its hash mismatches
were for std::vector::_M_realloc_append, which libstdc++ has only from
GCC 14 on.

The Linux PGO entry now:

- passes --gcc-install-dir for GCC 13 (PGO_GCC_MAJOR) when compiling
  and, through CMAKE_CXX_FLAGS, when linking;
- fails early in its clang install step if that GCC's headers are
  missing, so that a later image cannot fall back silently;
- warns if the installed clang is not PGO_CLANG_BUILD, the build that
  trained the profile. apt.llvm.org keeps only the newest snapshot of
  each major, so an exact pin would fail the install once it moves.

Every Linux entry prints the standard library it compiles against.

docs/CI.md says what training and the job must agree on (the clang
build, the standard library headers and the configuration) and how
each is held. It also gains the rule this came from: a measurement that
backs a profile is taken on a binary built exactly as the job builds
it.

Checked on a Steam Deck with the fork's profile of the same kind (the
job's PGO flags, --gcc-install-dir for GCC 13, a checkout other than
the training one): "Selected GCC installation:
/usr/lib/gcc/x86_64-linux-gnu/13", and 4 hash mismatches, none with
counts.

This PR's own run is what shows two things: that clang selects 13 with
14 present on the hosted image, and the counts for this PR's profile
(the printed toolchain and the PGO summary).
actionlint passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxAKTuSh2fpgFJdwbE
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
The profile was trained on a tree 20 upstream commits older. Applied to
this one with the job's flags, it had lost its data for 12 functions
that training had reached, among them the shader compiler's SSA rewrite
pass and the Vulkan fence manager's release thread, and the
missing-profile warnings had grown from 1,132 to 1,311.

lichii-linux.profdata is retrained on this tree with the toolchain the
job now pins: an Ubuntu 24.04 container with clang
23.1.6~++20261116013850+5b10d2d74929 (PGO_CLANG_BUILD) and GCC 13's
standard library, the local function names keyed from src/.
eglantine.profdata, with its author's checkout prefix stripped, weight 1,
merged with two sessions of Ocarina of Time on a Steam Deck, weight 12.
21,523,104 bytes, sha256
86c4bd405fab9b08e2535279c53f84c3224c2643a4bf47eab2905a422c25c229.

Applied from a checkout other than the training one with this tree's
Linux PGO flags (and the comdat and weak mismatch warnings on, for the
count), building lichii and lichii-cmd: 5 hash mismatches, the only one
with counts lichii-cmd's main, whose name the lichii executable's main
also has; none in src/ otherwise; 1,282 missing-profile warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcx3CbFgcY6d7BpdyKC
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
… summary did not show

From review of this PR before it is published.

The summary could not show the failure this PR is about:

- hash mismatches raised no annotation;
- those of template and inline functions were not counted at all;
- a summary of zeros read as a perfect profile, though it is also what
  dropped warning flags give.

So the PGO build now:

- passes -mllvm -no-pgo-warn-mismatch-comdat-weak=false, so template
  and inline functions' mismatches are reported too. It changes only
  diagnostics. On the committed profile and this tree it adds no
  function with counts beyond lichii-cmd's main.
- warns when more than PGO_MISMATCH_MAX (10) functions lost profile
  data that had counts (retrain);
- warns when there are no missing-profile warnings at all: the flags
  that report them did not reach the build.

The GCC pin is checked, not only printed:

- the configure step stops the job unless clang reports the pinned GCC
  as its "Selected GCC installation";
- the GCC directory's triple comes from gcc -dumpmachine;
- the clang-build warning names the matrix's profile.

Comments and docs/CI.md corrected to what was measured:

- the missing-profile count of the committed profile on its own tree is
  1,282 (not "about 1,100"); the unsourced "about 13,800" is gone;
- path-keyed names are about a fifth of the profile (14,763 of 78,301
  records), not a seventh;
- the retrain rule: 12 functions lost over 20 upstream commits, not
  "roughly five per commit", and the summary's count is the signal;
- step 1 of the retrain recipe passes --gcc-install-dir;
- the crt files and libgcc follow the pin, libstdc++.so.6 is the
  system's single copy either way;
- the missing-headers check runs before configure fails on the flag;
- eglantine.profdata was trained against libstdc++ 14 or later (it holds
  std::vector::_M_realloc_append records, which GCC 13's headers lack).
  With the job on 13, its records whose inlined library code differs no
  longer match.

actionlint passes. Not run on a hosted runner: the workflow runs on
dispatch, a push to nx2-experimental or its schedule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxAKTuSh2fpgFJdwbE
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
…ary from failing a build

The mismatch warning counted log lines. A function that lost its data
in several translation units warns once per unit:

- the previous profile on this tree gave 13 lines for 12 functions;
- our fork's run 9 gave 787 lines for 308.

It now counts distinct function names. The name follows
"(hash mismatch) ", and mangled names hold no spaces. The summary's
two figures are counted the same way, and say so: functions whose
profile data was discarded, and of them those with nonzero counts.
The missing-profile count stays one per function and translation
unit, as its line now says.

The summary block now runs in a subshell whose failure is a warning
("the build itself succeeded"), so no command in it can fail a build
that has already finished, as in our fork's job. The lost count also
survives pipefail when nothing matches.

Checked on a sample log: a function with counts in two units, another
with counts, and one without counts give 3 discarded, 2 with nonzero
counts and lost = 2; an empty log gives 0. actionlint passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxAKTuSh2fpgFJdwbE
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
@danieljesus

Copy link
Copy Markdown
Contributor Author

A correction before this merges. The description said the profile was trained "in the job's own container image". The job builds on the hosted ubuntu-24.04 runner, with no container.

The profile was trained with GCC 13's libstdc++. Unpinned, the runner's clang picks GCC 14's. We hit exactly this on our fork's release run: its Linux PGO build lost the profile on 308 functions with counts, most visibly std::vector::_M_realloc_append, which GCC 13's headers don't have.

This push:

  • merges nx2;
  • pins GCC 13 for the PGO entry (--gcc-install-dir, with an early failure if it is missing, and a gate on the GCC clang selects), and warns if the installed clang build differs from the training one;
  • makes the summary able to see a lost profile: template mismatches counted, a warning past 10 functions lost with counts, and one when no missing-profile warnings appear at all;
  • adds the rule to docs/CI.md: measure the binary the job builds;
  • retrains lichii-linux.profdata on this tree. Applied to a tree 20 commits newer, the previous one had lost its data for 12 of our functions with counts; retrained, none (only lichii-cmd's main, which shares its name with lichii's).

The description is corrected. The fps figures come from the profile as first trained, on the tree before this refresh, against eglantine.profdata built with GCC 13's headers (not the published build). The job's own artifact needs a manual run, which we'll do and report: its "Selected GCC installation" line and PGO summary.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF

@danieljesus

Copy link
Copy Markdown
Contributor Author

The manual run, on our fork, of this branch's head (d2e96fa, publish_release=false): all six build jobs passed. From the linux-x86_64-pgo job's log, on the hosted ubuntu-24.04 runner:

Ubuntu clang version 23.1.6 (++20261116013850+5b10d2d74929-1~exp1~20261116133903.98)
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13

That is the clang build the profile was trained with, and the pinned GCC; the gate passed.

Its PGO figures, counted from the build log:

  • functions whose profile data was discarded: 5, one of them with counts (main, lichii-cmd's, as expected; the other four are zstd's ZDICT_*, with none);
  • missing-profile warnings: 1,284 (a Steam Deck build of the same tree gave 1,282), 883 of them in bundled dependencies;
  • no warning annotations.

So on the runner the profile applies as it did where it was trained. Still not measured: fps of this artifact against a published build.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF

atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 28, 2026
@danieljesus

Copy link
Copy Markdown
Contributor Author

The measurement the description listed as missing: this PR's artifact against a build made as the job builds nx2 today.

  • A: the linux-x86_64-pgo artifact of the manual run above (this branch's head, d2e96fa).
  • B: nx2 d17f0ee built with the job's flags as they are on nx2: the same clang 23.1.6 build choosing its GCC by itself (it selected GCC 14, as on the runner), eglantine.profdata, no pin. That build reports 2,169 functions whose profile data was discarded, 840 of them with counts.

Steam Deck OLED, Ocarina of Time, Kokiri Forest, nothing instrumented, default power settings, same session, a warm-up each and then alternating runs:

B (nx2 as built today) A (this PR) Change
Standing fps 21.04 22.20 +5.5 %
Turning the camera, fps 17.07 18.12 +6.2 %
GPU back thread on CPU 68–70 % 60–62 %

Four runs of A and three of B (B's fourth did not reach the scene: the driver reported a device loss during boot, once in nine boots of B and none in nine of A; one event, so it says nothing by itself). A was ahead in every pair. Standing, every A run (21.94–22.47) is above every B run (20.98–21.11).

So against what the job ships today the gain is +5.5 % and +6.2 %, a little under the +6.6 % and +8.1 % in the description's table, whose baseline was eglantine.profdata built against GCC 13's headers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF

atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 28, 2026
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 29, 2026
danieljesus and others added 2 commits November 29, 2026 03:56
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
atmanli added a commit to atmanli/Lichii that referenced this pull request Nov 29, 2026
danieljesus and others added 6 commits November 29, 2026 05:56
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Brings the branch up to date with nx2 so that the PR's checks run against the current base. No conflicts; no other change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RcHkcxSN7aBbebPQ17pqcF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant